package com.yc.framework.config;

import com.yc.framework.baseClass.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionConfig {
    @ExceptionHandler(RuntimeException.class)
    public R runtimeException(RuntimeException e) {
        e.printStackTrace();
        log.error("YC Exception", e);
//        return R.err("程序出现异常，请联系管理员");
        return R.err(e.getMessage());
    }
}